import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)
// 路由懒加载
const Home = (resolve) => {
  import('@/pages/home/home').then((module) => {
    resolve(module)
  })
}
const Index = (resolve) => {
  import('@/pages/home/index').then((module) => {
    resolve(module)
  })
}
const GuideList = (resolve) => {
  import('@/pages/guide/guideList').then((module) => {
    resolve(module)
  })
}
const CollegeList = (resolve) => {
  import('@/pages/guide/college').then((module) => {
    resolve(module)
  })
}
const UserList = (resolve) => {
  import('@/pages/guide/userList').then((module) => {
    resolve(module)
  })
}
const NewsList = (resolve) => {
  import('@/pages/news/newsList').then((module) => {
    resolve(module)
  })
}
const Classification = (resolve) => {
  import('@/pages/news/classification').then((module) => {
    resolve(module)
  })
}
const WorkList = (resolve) => {
  import('@/pages/works/workList').then((module) => {
    resolve(module)
  })
}
const Examine = (resolve) => {
  import('@/pages/works/examine').then((module) => {
    resolve(module)
  })
}
const Login = (resolve) => {
  import('@/pages/login').then((module) => {
    resolve(module)
  })
}

const Forget = (resolve) => {
  import('@/pages/forget').then((module) => {
    resolve(module)
  })
}
export default new Router({
  routes: [
    // 根路径
    {
      path: '/',
      name: 'Login',
      component: Login,
    },
    {
      path: '/login',
      name: 'Login',
      component: Login,
    },

    {
      path: '/forget',
      name: 'Forget',
      component: Forget,
    },
    {
      path: '/',
      name: 'Home',
      component: Home,
      children: [
        {
          path: 'index',
          component: Index
        },
        {
          path: 'guideList',
          component: GuideList
        },
        {
          path: 'college',
          component: CollegeList
        },
        {
          path: 'userList',
          component: UserList
        },
        // 新闻 
        {
          path: 'newsList',
          component: NewsList
        },
        {
          path: 'classification',
          component: Classification
        },
        //微课
        {
          path: 'workList',
          component: WorkList
        },
        {
          path: 'examine',
          component: Examine
        },
      ]
    },

  ]
})